package com.zt.chatglm;

import com.zt.chatglm.domain.chat.*;
import com.zt.chatglm.domain.image.ImageCompletionRequest;
import com.zt.chatglm.domain.image.ImageCompletionResponse;
import io.reactivex.Single;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * @author: zt
 * @Description: OpenAi 接口，用于扩展通用类服务
 * @create: 2024-05-20 21:30
 */

public interface IOpenAiApi {

    /**
     * 旧版v3模型-sse流式
     */
    String v3_completions = "api/paas/v3/model-api/{model}/sse-invoke";

    /**
     * 旧版v3模型-异步
     */
    String v3_completions_async = "api/paas/v3/model-api/{model}/invoke";

    /**
     * 新版v4模型-sse流式/异步，通过请求参数stream设置
     * https://open.bigmodel.cn/dev/api#glm-4
     */
    String v4_completions = "api/paas/v4/chat/completions";


    /**
     * 新版文生图模型-同步
     * https://open.bigmodel.cn/dev/api#cogview
     */
    String cog_view3 = "api/paas/v4/images/generations";

    @POST(v3_completions)
    Single<ChatCompletionResponse> completions(@Path("model") String model, @Body ChatCompletionRequest completionRequest);

    @POST(v3_completions_async)
    Single<ChatCompletionSyncResponse> completions(@Body ChatCompletionRequest completionRequest);

    @POST(cog_view3)
    Single<ImageCompletionResponse> genImages(@Body ImageCompletionRequest completionRequest);

}
